<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function showEven() {
            for (var i = 1; i <= number; i++) {
                if (i % 2 == 0) {
                    console.log('%s是偶数', i);
                }
            }
        }
        var number = 50;
        showEven(); // 1~50
        number = 200
        showEven(); // 1~200
    </script>
</body>

</html>